package com.meitianiot.module.smart.controller.app.test;

import com.meitianiot.framework.common.pojo.CommonResult;
import com.meitianiot.module.smart.service.TestService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.meitianiot.framework.common.pojo.CommonResult.success;

@Tag(name = "Smart APP - 测试专用")
@RestController
@RequestMapping("/smart/test")
@Validated
@Slf4j
public class AppTestController {

    @Resource
    private TestService testService;

    @GetMapping("/helloworld")
    @Operation(summary = "测试")
    public CommonResult<String> helloWorld() {

        // 发送 mqtt 消息
        testService.sendTest();

        return success("Hello world");
    }

}
